package com.loong.android.tools;

import android.os.Environment;

/**
 * 系统存储，获取内部或外部存储卡的目录，容量等
 */
public class Storage {

    /**
     * 取外部存储的目录路径
     */
    public static String getExternalDirPath() {
        return Environment.getExternalStorageDirectory().getAbsolutePath();
    }

    /**
     * 取外部存储的可用状态
     */
    public static boolean getExternalState() {
        return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    }

    /**
     * 取外部存储总容量，单位为B
     */
    public static long getExternalTotalSpace() {
        return Environment.getExternalStorageDirectory().getTotalSpace();
    }

    /**
     * 取外部存储可用容量，单位为B
     */
    public static long getExternalUsableSpace() {
        return Environment.getExternalStorageDirectory().getUsableSpace();
    }


    public static String getInternalDirPath() {
        return Environment.getDataDirectory().getAbsolutePath();
    }

    /**
     * 取内部存储总容量，单位为B
     */
    public static long getInternalTotalSpace() {
        return Environment.getDataDirectory().getTotalSpace();
    }

    /**
     * 取内部存储可用容量，单位为B
     */
    public static long getInternalUsableSpace() {
        return Environment.getDataDirectory().getUsableSpace();
    }
}
